package com.czk.model.proxy.dynamincproxy;

/**
 * @Author:ChenZhangKun
 * @Date: 2020/4/27 22:10
 */
public class Client {
    public static void main(String[] args) {
        //设置为true则会将生成的字节码保存
        System.getProperties().put("sun.misc.ProxyGenerator.saveGeneratedFiles","true");
        // 目标对象
        TeacherDaoImpl target=new TeacherDaoImpl();
        // 创建代理对象
        ProxyFactory proxyFactory=new ProxyFactory(target);
        ITeacherDao proxyInstance =(ITeacherDao) proxyFactory.getProxyInstance();
        proxyInstance.teach();
        System.out.println(proxyInstance.getClass());
    }
}
